#

| Chapter 35 You Can't Quite Call This Editing |

## 35.23 Rotating Text

Every now and then you come across something and say, "Gee, that might come in handy someday, but I have no idea for what." This might happen to you when you're browsing at a flea market or garage sale; or if you're like us, it might happen when you're browsing through public domain software.

rot | Which brings us to the rot program. rot basically just rotates text columns and rows. For example, the first column below shows an input file. The other three columns show the same file fed through rot once, twice, and three times:

>     $ cat file      $ rot file      $ rot file |      $ rot file |
>                                          rot              rot | rot
>      abcde           54321                 5             e
>     1                     a                4             d
>     2                     b                3             c
>     3                     c                2             b
>     4                     d                1             a
>     5                     e           edcba               12345

Now let's compare combinations of rot and tail -r (25.19):

>     $ cat file      $ rot file      $ rot file |      $ tail -r file |
>                                          tail -r           rot
>      abcde           54321                 e              12345
>     1                     a                d             a
>     2                     b                c             b
>     3                     c                b             c
>     4                     d                a             d
>     5                     e           54321              e

rot rotates the text 90 degrees. tail -r turns the text "upside down" (last line in becomes the first line out, and so forth).

rot can also rotate the output of banner (43.11) to print down a page instead of across. By now, we hope you have an idea of what rot can do!

- JP, LM

35.22 Straightening Jagged Columns |  | 36. Sorting